package org.example;

import java.util.ArrayList;
import java.util.List;

public class Test5 {
    //leetcode 78 子集 https://leetcode.cn/problems/subsets/description/
    public List<List<Integer>> ret;
    public List<Integer> path;
    public List<List<Integer>> subsets(int[] nums) {
        ret = new ArrayList<>();
        path = new ArrayList<>();
        backtracking(nums,0);
        return ret;
    }

    public void backtracking(int[] nums, int start) {
        ret.add(new ArrayList<>(path));
        for (int i = start; i <  nums.length; i++) {
            path.add(nums[i]);
            backtracking(nums,i + 1);
            path.remove(path.size() - 1);
        }
    }

    public static void main(String[] args) {
        Test5 test5 = new Test5();
        int[] arr = {1,2,3};
        test5.subsets(arr);
        System.out.println(444);
    }
}
